package zhibi.wechat.mp.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import zhibi.frame.domain.Page;
import zhibi.frame.mybatis.example.Example;
import zhibi.wechat.mp.domain.Msg;
import zhibi.wechat.mp.extra.base.BaseServiceImpl;
import zhibi.wechat.mp.extra.pojo.MsgPo;
import zhibi.wechat.mp.mapper.MsgMapper;
import zhibi.wechat.mp.service.MsgService;

@Service
@Transactional
public class MsgServiceImpl extends BaseServiceImpl<Msg> implements MsgService {


    @Autowired
    public MsgServiceImpl(MsgMapper mapper) {
        super(mapper);
        this.msgMapper = mapper;
    }

    private MsgMapper msgMapper;

    @Override
    public PageInfo<MsgPo> selectPoByExample(Example example, Page page) {
        if (page != null) PageHelper.startPage(page.getPageNum(), page.getPageSize());
        return new PageInfo<>(msgMapper.selectPoByExample(example), Page.NAV_SIZE);
    }
}
